#pragma once
#include "VulkanDevice.h"
#include "VulkanSemaphore.h"
namespace Alice{
    struct VulkanSwapChainRecreateInfo
    {
        VkSwapchainKHR mSwapChain;
        VkSurfaceKHR mSurface;
    };
    class VulkanSwapChain{
    public:
        VkSwapchainKHR mSwapChain;
        VulkanDevice&mDevice;
        VkSurfaceKHR mSurface;
        void*mWindowHandle;
        int32 mCurrentImageIndex;
        int32 mSemaphoreIndex;
        uint32 mNumPresentCalls;
        uint32 mNumAcquireCalls;
        uint32 mInternalWidth;
        uint32 mInternalHeight;
        VkInstance mInstance;
        int8 mLockToVSync;
        std::vector<VulkanSemaphore*> mImageAcquiredSemaphores;
        VkSurfaceTransformFlagBitsKHR mPreTransform;
        VulkanSwapChain(VkInstance inInstance, VulkanDevice& inDevice, void* inWindowHandle, EPixelFormat& inOutPixelFormat, uint32 inWidth, uint32 inHeight,
            bool bIsFullscreen,uint32* inOutDesiredNumBackBuffers, std::vector<VkImage>& inOutImages, int8 bLockToVsync, VulkanSwapChainRecreateInfo* inRecreateInfo);
        inline VkSurfaceTransformFlagBitsKHR GetCachedSurfaceTransform() const { return mPreTransform; }
        uint32 AcquireImageIndex(VulkanSemaphore** OutSemaphore);
    };
}